<?php
# Antecedentes personales
echo "<table id=\"tablaAntecmedic\" cellspacing=\"0\" cellpadding=\"0\" class=\"formTable\" style=\"display: none\">\n";

echo "<tr><td>\n";
echo "<table cellspacing=\"0\" cellpadding=\"0\" class=\"tokensTable\">\n";
echo "<tr>\n";
echo "<td class=\"blankToken\">&nbsp;</td>\n";
echo "<td class=\"token2\" onclick=\"mostrarTabla1('Alergias');\"><nobr>Alergias</nobr></td>\n";
echo "<td class=\"blankToken\">&nbsp;</td>\n";
echo "<td class=\"activeToken2\"><nobr>Antecedentes personales</nobr></td>\n";
echo "<td class=\"blankToken\">&nbsp;</td>\n";
echo "<td class=\"token2\" onclick=\"mostrarTabla1('Antecquirur');\"><nobr>Antecedentes quir&uacute;rgicos</nobr></td>\n";
echo "<td class=\"token2\" onclick=\"mostrarTabla1('Tratamhabit');\"><nobr>Tratamiento habitual</nobr></td>\n";
echo "<td class=\"lastToken\">&nbsp;</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</td></tr>\n";

echo "<tr valign=\"top\"><td class=\"tokenContent2\">\n";
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\n";
echo "<tr valign=\"top\">\n";

echo "<td width=\"65%\" class=\"paddedTd\">\n";
echo "<div class=\"optionlistLayer\">\n";
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">\n";

$query = "SELECT id_antecmedic, antecmedic FROM listaantecmedic ORDER BY antecmedic";
$q_antecmedic = mysql_query($query, $sock);

echo "<input type=\"hidden\" name=\"num_antecmedic\" value=\"".mysql_num_rows($q_antecmedic)."\">\n";
$contador = 0;

while ($row_antecmedic = mysql_fetch_object($q_antecmedic))
{
	$id_antecmedic = $row_antecmedic->id_antecmedic;
	$antecmedic = $row_antecmedic->antecmedic;

	if (isset($arr_antecmedic) && in_array($id_antecmedic, $arr_antecmedic)) $sel_antecmedic .= $contador.",";

	echo "<input type=\"hidden\" name=\"id_antecmedic[".$contador."]\" value=\"".$id_antecmedic."\">\n";
	echo "<input type=\"hidden\" name=\"txt_antecmedic[".$contador."]\" value=\"".htmlentities(stripslashes($antecmedic), ENT_QUOTES)."\">\n";

	echo "<tr valign=\"top\">\n";
	echo "<td width=\"1%\"><input type=\"checkbox\" name=\"antecmedic[".$contador."]\" class=\"checkBox\"".(isset($arr_antecmedic) && in_array($id_antecmedic, $arr_antecmedic) ? " checked" : "")." onclick=\"selectCheck('sel_antecmedic', ".$contador.", this.checked); updateInfo1();\"></td>\n";
	echo "<td width=\"99%\">".stripslashes($antecmedic)."</td>\n";
	echo "</tr>\n";

	$contador ++;
}

echo "<input type=\"hidden\" name=\"sel_antecmedic\" value=\"".(isset($sel_antecmedic) ? $sel_antecmedic : "")."\">\n";

echo "</table>\n";
echo "</div>\n";
echo "</td>\n";

echo "<td width=\"35%\">\n";
echo "<textarea name=\"amp_antecmedic\" class=\"ampBox\">".(isset($row_pacientes) ? stripslashes($row_pacientes->amp_antecmedic) : "")."</textarea>\n";
echo "</td>\n";

echo "</tr>\n";
echo "</table>\n";
echo "</td></tr>\n";

echo "</table>\n";
?>